@echo off
set DIR=skype

echo %DIR%
cd %DIR%

del archive.7z 

rem GENERATE AUTOMATICALLY entries.ini FILE
echo [EditFile] > entries.ini
echo I386\SVCPACK.INF,SetupHotfixesToRun,AddProgram >> entries.ini
echo [AddProgram] >> entries.ini
echo %DIR%.exe >> entries.ini

rem GENERATE config.txt
set /p cmdline=<cmdline.txt
echo ;!@Install@!UTF-8! > config.txt
echo RunProgram="%cmdline%" >> config.txt
echo GUIMode="2" >> config.txt
echo ;!@InstallEnd@! >> config.txt

rem CREATE THE AUTO EXTRACT ARCHIVE
..\7z.exe a -t7z -mx9 -x@..\exclude.lst archive.7z *
copy /b ..\7zsd.sfx + config.txt + archive.7z %DIR%.exe
del archive.7z

rem CREATE CABINET FILE
echo .set rptfilename=nul > %DIR%.ddf
echo .set inffilename=nul >> %DIR%.ddf
echo .set maxdisksize=cdrom >> %DIR%.ddf
echo .set sourcedir=. >> %DIR%.ddf
echo .set cabinetname1="%DIR%.cab" >> %DIR%.ddf
echo .set diskdirectory1=. >> %DIR%.ddf
echo .set destinationdir= >> %DIR%.ddf
echo entries.ini >> %DIR%.ddf
echo .set destinationdir=svcpack >> %DIR%.ddf
echo %DIR%.exe >> %DIR%.ddf

..\makecab /f %DIR%.ddf

del %DIR%.ddf
del %DIR%.exe
del config.txt
del entries.ini
move %DIR%.cab ..\
cd ..

